<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="/jquery-1.8.3.min.js"></script>
    <meta name="_token" content="{{ csrf_token() }}"/>
    <style>
        tr{
            text-align:center;
            font-size:14px;
            color:#333;
        }
    </style>
</head>
<body>
<center>
    <h1>名片管理列表</h1>
    <a href="/mindcard/public/admin/index/list">名片列表</a> | <a href="/mindcard/public/card/insert?id={{ session('admin')['id'] }}">名片添加</a>
    <a href="/mindcard/public/classify/index">分组列表</a>
    <br><br>
    <form action="/mindcard/public/admin/index" method=""post>
        搜索名字： <input type="text" name="sname" value="">
        <button type="submit">搜索名字</button><br>
    </form>
    <form action="/mindcard/public/admin/index" method=""post>
        搜索公司： <input type="text" name="scompany" value="">
        <button type="submit">搜索公司</button><br><br>
    </form>
    添加分组： <input type="text" id="group" value="">
    <button type="submit" class="click" click="fun()">添加</button>

    <hr>
</center>

<center>
    {{--<img src="/mindcard/public/admin/images/login.jpg" alt="" style="width:200px; height:150px;">--}}
    <table border="1" width="">
        <tr>
            <th>名字</th>
            <th>职位</th>
            <th>公司名</th>
            <th>地址</th>
            <th>手机</th>
            <th>网址</th>
            <th>邮箱</th>
            <th>所属分类</th>
            <th>操作</th>
        </tr>
        @foreach($data as $key=>$val)
            <tr>
                <td>{{$val['name']}}</td>
                <td>{{$val['position']}}</td>
                <td>{{$val['company']}}</td>
                <td>{{$val['address']}}</td>
                <td>{{$val['cell']}}</td>
                <td>{{$val['url']}}</td>
                <td>{{$val['email']}}</td>
                <td>{{$val['classify']}}</td>
                <td>
                    <a href="/mindcard/public/card/edit?id={{ $val['id'] }}">修改</a>
                    <a href="/mindcard/public/card/delete?id={{ $val['id'] }}">删除</a>
                </td>
            </tr>
        @endforeach
    </table>

    {!! $data->render() !!}
</center>
<script>
    $(function(){
        var $click = $('.click');
        //发送ajax添加分组
        $click.click(function() {
            var $value = $('#group').val();
            $.get("/mindcard/public/card/class?classname="+$value+"&uid="+{{ session('admin')['id'] }},function($data){
                alert($data);
            })
        });

        var $sname = $('.sname');

    });
</script>
</body>
</html>